#include <cstdio>
#include <functional>
#include <algorithm>

using namespace std;

int main(int argc, char const *argv[])
{
    int s[4], arr[4][32];
    int i, j, s1, s2, result;
    for (i = 0; i < 4; i++)
    {
        scanf("%d", &s[i]);
    }
    for (i = 0; i < 4; i++)
    {
        for (j = 0; j < s[i]; j++)
        {
            scanf("%d", &arr[i][j]);
        }
    }
    result = 0;
    for (i = 0; i < 4; i++)
    {
        sort(arr[i], arr[i] + s[i], greater<int>());
        s1 = 0;
        s2 = 0;
        for (j = 0; j < s[i]; j++)
        {
            if (s1 <= s2)
            {
                s1 += arr[i][j];
            }
            else
            {
                s2 += arr[i][j];
            }
        }
        result += max(s1, s2);
        // printf("%d\n", max(s1, s2));
    }
    printf("%d", result);
    return 0;
}
